import request from '../../utils/request.js'

const state = {
	navBarList: [],
	indexData:{}
}

const mutations = {
	changeIndexData(state, indexData) {
		// 同步修改状态 
		state.indexData = indexData;
		state.navBarList = indexData.kingKongModule.kingKongList;
	}
}

const actions = {
	async getIndexDataAction({commit}){
		// 异步获取数据
		let result = await request('/getIndexData');
		// 将异步数据交给mutations
		commit('changeIndexData',result)
	}
}

const getters = {

}

export default {
	state,
	mutations,
	actions,
	getters
}
